#region File Description
//-----------------------------------------------------------------------------
// MainMenuScreen.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

#region Using Statements
using System;
using System.Threading;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using GGJ.Sprites;
using System.Collections.Generic;
#endregion

namespace GGJ
{
    /// <summary>
    /// The main menu screen is the first thing displayed when the game starts up.
    /// </summary>
    /// 
    class IntroScreen:MenuScreen
    {
        Rectangle source = new Rectangle(0, 0, 600, 250);
        Rectangle destination = new Rectangle(0, 250, 800, 250);
        Texture2D intro1Texture;
        ContentManager content;

        String image;
        String message;


        public IntroScreen(String message,String image,String nextMessage): base("")
        {
            this.image = image;
            this.message = message;


             // Create our menu entries.
            MenuEntry next = new MenuEntry(nextMessage);

            // Hook up menu event handlers.
            next.Selected += PlayNextMenuEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(next);
        }

        public virtual void onNext(object sender, PlayerIndexEventArgs e)
        {

        }

        void PlayNextMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            onNext(sender,e);
            //ScreenManager.AddScreen(new IntroTwoScreen(), e.PlayerIndex);
        }

          public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");


            intro1Texture = content.Load<Texture2D>(image);
        }


        /// <summary>
        /// Unload graphics content used by the game.
        /// </summary>
        public override void UnloadContent()
        {
            content.Unload();
        }


        public override int DrawContent(SpriteBatch spriteBatch)
        {
            String texte = message;

            Color titleColor = new Color(240, 240, 192) * TransitionAlpha;
            float transitionOffset = (float)Math.Pow(TransitionPosition, 2);
            SpriteFont font = ScreenManager.Font;
            Vector2 origin = font.MeasureString(texte) / 2;
            Vector2 position = new Vector2(400, origin.Y + 20);    
            float titleScale = 0.9f;


            spriteBatch.DrawString(font, texte, position, titleColor, 0,
                                origin, titleScale, SpriteEffects.None, 0);

            spriteBatch.Draw(intro1Texture, destination, source, Color.White);

            return 0;
        }
    }
    
    class IntroOneScreen : IntroScreen
    {
        public IntroOneScreen()
            : base("We don't see things as they are, we see them as we are", "intro1", "Next")
        {

        }

        public override void onNext(object sender, PlayerIndexEventArgs e)
        {
            ScreenManager.AddScreen(new IntroTwoScreen(), e.PlayerIndex);
        }
    }
   
    class IntroTwoScreen : IntroScreen
    {
        public IntroTwoScreen()
            : base("The fly people are abused by humans, the \nhorrible flyswatter and all those mass destruction \nweapons are destroying our families and our species ... \nAnd no one see that", "intro2", "Next")
        {

        }

        public override void onNext(object sender, PlayerIndexEventArgs e)
        {
            ScreenManager.AddScreen(new IntroThreeScreen(), e.PlayerIndex);
        }
    }
    class IntroThreeScreen : IntroScreen
    {
        public IntroThreeScreen()
            : base("It is time for change my friends !\nToday we are raising an army ...", "intro3","Go to war")
        {

        }

        public override void onNext(object sender, PlayerIndexEventArgs e)
        {
            ScreenManager.AddScreen(new BackgroundScreen(), e.PlayerIndex);
            ScreenManager.AddScreen(new MainMenuScreen(), e.PlayerIndex);
        }
    }
}
